3.1.12 \(\int \frac {c+d \sec (e+f x)}{a+b \cos (e+f x)} \, dx\) [12]

Optimal. Leaf size=76 \[ \frac {2 (a c-b d) \text {ArcTan}\left (\frac {\sqrt {a-b} \tan \left (\frac {1}{2} (e+f x)\right )}{\sqrt {a+b}}\right )}{a \sqrt {a-b} \sqrt {a+b} f}+\frac {d \tanh ^{-1}(\sin (e+f x))}{a f} \]

[Out]

d*arctanh(sin(f*x+e))/a/f+2*(a*c-b*d)*arctan((a-b)^(1/2)*tan(1/2*f*x+1/2*e)/(a+b)^(1/2))/a/f/(a-b)^(1/2)/(a+b)
^(1/2)

________________________________________________________________________________________

Rubi [A]
time = 0.10, antiderivative size = 76, normalized size of antiderivative = 1.00, number of steps used = 5, number of rules used = 5, integrand size = 23, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.217, Rules used = {2907, 3080, 3855, 2738, 211} \begin {gather*} \frac {2 (a c-b d) \text {ArcTan}\left (\frac {\sqrt {a-b} \tan \left (\frac {1}{2} (e+f x)\right )}{\sqrt {a+b}}\right )}{a f \sqrt {a-b} \sqrt {a+b}}+\frac {d \tanh ^{-1}(\sin (e+f x))}{a f} \end {gather*}

Antiderivative was successfully verified.

[In]

Int[(c + d*Sec[e + f*x])/(a + b*Cos[e + f*x]),x]

[Out]

(2*(a*c - b*d)*ArcTan[(Sqrt[a - b]*Tan[(e + f*x)/2])/Sqrt[a + b]])/(a*Sqrt[a - b]*Sqrt[a + b]*f) + (d*ArcTanh[
Sin[e + f*x]])/(a*f)

Rule 211

Int[((a_) + (b_.)*(x_)^2)^(-1), x_Symbol] :> Simp[(Rt[a/b, 2]/a)*ArcTan[x/Rt[a/b, 2]], x] /; FreeQ[{a, b}, x]
&& PosQ[a/b]

Rule 2738

Int[((a_) + (b_.)*sin[Pi/2 + (c_.) + (d_.)*(x_)])^(-1), x_Symbol] :> With[{e = FreeFactors[Tan[(c + d*x)/2], x
]}, Dist[2*(e/d), Subst[Int[1/(a + b + (a - b)*e^2*x^2), x], x, Tan[(c + d*x)/2]/e], x]] /; FreeQ[{a, b, c, d}
, x] && NeQ[a^2 - b^2, 0]

Rule 2907

Int[(csc[(e_.) + (f_.)*(x_)]*(d_.) + (c_))^(n_.)*((a_) + (b_.)*sin[(e_.) + (f_.)*(x_)])^(m_.), x_Symbol] :> In
t[(a + b*Sin[e + f*x])^m*((d + c*Sin[e + f*x])^n/Sin[e + f*x]^n), x] /; FreeQ[{a, b, c, d, e, f, m}, x] && Int
egerQ[n]

Rule 3080

Int[((A_.) + (B_.)*sin[(e_.) + (f_.)*(x_)])/(((a_.) + (b_.)*sin[(e_.) + (f_.)*(x_)])*((c_.) + (d_.)*sin[(e_.)
+ (f_.)*(x_)])), x_Symbol] :> Dist[(A*b - a*B)/(b*c - a*d), Int[1/(a + b*Sin[e + f*x]), x], x] + Dist[(B*c - A
*d)/(b*c - a*d), Int[1/(c + d*Sin[e + f*x]), x], x] /; FreeQ[{a, b, c, d, e, f, A, B}, x] && NeQ[b*c - a*d, 0]
 && NeQ[a^2 - b^2, 0] && NeQ[c^2 - d^2, 0]

Rule 3855

Int[csc[(c_.) + (d_.)*(x_)], x_Symbol] :> Simp[-ArcTanh[Cos[c + d*x]]/d, x] /; FreeQ[{c, d}, x]

Rubi steps

\begin {align*} \int \frac {c+d \sec (e+f x)}{a+b \cos (e+f x)} \, dx &=\int \frac {(d+c \cos (e+f x)) \sec (e+f x)}{a+b \cos (e+f x)} \, dx\\ &=\frac {d \int \sec (e+f x) \, dx}{a}+\frac {(a c-b d) \int \frac {1}{a+b \cos (e+f x)} \, dx}{a}\\ &=\frac {d \tanh ^{-1}(\sin (e+f x))}{a f}+\frac {(2 (a c-b d)) \text {Subst}\left (\int \frac {1}{a+b+(a-b) x^2} \, dx,x,\tan \left (\frac {1}{2} (e+f x)\right )\right )}{a f}\\ &=\frac {2 (a c-b d) \tan ^{-1}\left (\frac {\sqrt {a-b} \tan \left (\frac {1}{2} (e+f x)\right )}{\sqrt {a+b}}\right )}{a \sqrt {a-b} \sqrt {a+b} f}+\frac {d \tanh ^{-1}(\sin (e+f x))}{a f}\\ \end {align*}

________________________________________________________________________________________

Mathematica [A]
time = 0.17, size = 112, normalized size = 1.47 \begin {gather*} \frac {\frac {(-2 a c+2 b d) \tanh ^{-1}\left (\frac {(a-b) \tan \left (\frac {1}{2} (e+f x)\right )}{\sqrt {-a^2+b^2}}\right )}{\sqrt {-a^2+b^2}}+d \left (-\log \left (\cos \left (\frac {1}{2} (e+f x)\right )-\sin \left (\frac {1}{2} (e+f x)\right )\right )+\log \left (\cos \left (\frac {1}{2} (e+f x)\right )+\sin \left (\frac {1}{2} (e+f x)\right )\right )\right )}{a f} \end {gather*}

Antiderivative was successfully verified.

[In]

Integrate[(c + d*Sec[e + f*x])/(a + b*Cos[e + f*x]),x]

[Out]

(((-2*a*c + 2*b*d)*ArcTanh[((a - b)*Tan[(e + f*x)/2])/Sqrt[-a^2 + b^2]])/Sqrt[-a^2 + b^2] + d*(-Log[Cos[(e + f
*x)/2] - Sin[(e + f*x)/2]] + Log[Cos[(e + f*x)/2] + Sin[(e + f*x)/2]]))/(a*f)

________________________________________________________________________________________

Maple [A]
time = 0.28, size = 92, normalized size = 1.21

method result size
derivativedivides \(\frac {\frac {2 \left (a c -b d \right ) \arctan \left (\frac {\left (a -b \right ) \tan \left (\frac {f x}{2}+\frac {e}{2}\right )}{\sqrt {\left (a -b \right ) \left (a +b \right )}}\right )}{a \sqrt {\left (a -b \right ) \left (a +b \right )}}-\frac {d \ln \left (\tan \left (\frac {f x}{2}+\frac {e}{2}\right )-1\right )}{a}+\frac {d \ln \left (\tan \left (\frac {f x}{2}+\frac {e}{2}\right )+1\right )}{a}}{f}\) \(92\)
default \(\frac {\frac {2 \left (a c -b d \right ) \arctan \left (\frac {\left (a -b \right ) \tan \left (\frac {f x}{2}+\frac {e}{2}\right )}{\sqrt {\left (a -b \right ) \left (a +b \right )}}\right )}{a \sqrt {\left (a -b \right ) \left (a +b \right )}}-\frac {d \ln \left (\tan \left (\frac {f x}{2}+\frac {e}{2}\right )-1\right )}{a}+\frac {d \ln \left (\tan \left (\frac {f x}{2}+\frac {e}{2}\right )+1\right )}{a}}{f}\) \(92\)
risch \(-\frac {\ln \left ({\mathrm e}^{i \left (f x +e \right )}+\frac {i a^{2}-i b^{2}+a \sqrt {-a^{2}+b^{2}}}{b \sqrt {-a^{2}+b^{2}}}\right ) c}{\sqrt {-a^{2}+b^{2}}\, f}+\frac {\ln \left ({\mathrm e}^{i \left (f x +e \right )}+\frac {i a^{2}-i b^{2}+a \sqrt {-a^{2}+b^{2}}}{b \sqrt {-a^{2}+b^{2}}}\right ) b d}{\sqrt {-a^{2}+b^{2}}\, f a}+\frac {\ln \left ({\mathrm e}^{i \left (f x +e \right )}+\frac {-i a^{2}+i b^{2}+a \sqrt {-a^{2}+b^{2}}}{\sqrt {-a^{2}+b^{2}}\, b}\right ) c}{\sqrt {-a^{2}+b^{2}}\, f}-\frac {\ln \left ({\mathrm e}^{i \left (f x +e \right )}+\frac {-i a^{2}+i b^{2}+a \sqrt {-a^{2}+b^{2}}}{\sqrt {-a^{2}+b^{2}}\, b}\right ) b d}{\sqrt {-a^{2}+b^{2}}\, f a}+\frac {d \ln \left ({\mathrm e}^{i \left (f x +e \right )}+i\right )}{a f}-\frac {d \ln \left ({\mathrm e}^{i \left (f x +e \right )}-i\right )}{a f}\) \(327\)

Verification of antiderivative is not currently implemented for this CAS.

[In]

int((c+d*sec(f*x+e))/(a+b*cos(f*x+e)),x,method=_RETURNVERBOSE)

[Out]

1/f*(2*(a*c-b*d)/a/((a-b)*(a+b))^(1/2)*arctan((a-b)*tan(1/2*f*x+1/2*e)/((a-b)*(a+b))^(1/2))-d/a*ln(tan(1/2*f*x
+1/2*e)-1)+d/a*ln(tan(1/2*f*x+1/2*e)+1))

________________________________________________________________________________________

Maxima [F(-2)]
time = 0.00, size = 0, normalized size = 0.00 \begin {gather*} \text {Exception raised: ValueError} \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate((c+d*sec(f*x+e))/(a+b*cos(f*x+e)),x, algorithm="maxima")

[Out]

Exception raised: ValueError >> Computation failed since Maxima requested additional constraints; using the 'a
ssume' command before evaluation *may* help (example of legal syntax is 'assume(4*b^2-4*a^2>0)', see `assume?`
 for more de

________________________________________________________________________________________

Fricas [A]
time = 0.69, size = 308, normalized size = 4.05 \begin {gather*} \left [\frac {{\left (a^{2} - b^{2}\right )} d \log \left (\sin \left (f x + e\right ) + 1\right ) - {\left (a^{2} - b^{2}\right )} d \log \left (-\sin \left (f x + e\right ) + 1\right ) + \sqrt {-a^{2} + b^{2}} {\left (a c - b d\right )} \log \left (\frac {2 \, a b \cos \left (f x + e\right ) + {\left (2 \, a^{2} - b^{2}\right )} \cos \left (f x + e\right )^{2} - 2 \, \sqrt {-a^{2} + b^{2}} {\left (a \cos \left (f x + e\right ) + b\right )} \sin \left (f x + e\right ) - a^{2} + 2 \, b^{2}}{b^{2} \cos \left (f x + e\right )^{2} + 2 \, a b \cos \left (f x + e\right ) + a^{2}}\right )}{2 \, {\left (a^{3} - a b^{2}\right )} f}, \frac {{\left (a^{2} - b^{2}\right )} d \log \left (\sin \left (f x + e\right ) + 1\right ) - {\left (a^{2} - b^{2}\right )} d \log \left (-\sin \left (f x + e\right ) + 1\right ) + 2 \, \sqrt {a^{2} - b^{2}} {\left (a c - b d\right )} \arctan \left (-\frac {a \cos \left (f x + e\right ) + b}{\sqrt {a^{2} - b^{2}} \sin \left (f x + e\right )}\right )}{2 \, {\left (a^{3} - a b^{2}\right )} f}\right ] \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate((c+d*sec(f*x+e))/(a+b*cos(f*x+e)),x, algorithm="fricas")

[Out]

[1/2*((a^2 - b^2)*d*log(sin(f*x + e) + 1) - (a^2 - b^2)*d*log(-sin(f*x + e) + 1) + sqrt(-a^2 + b^2)*(a*c - b*d
)*log((2*a*b*cos(f*x + e) + (2*a^2 - b^2)*cos(f*x + e)^2 - 2*sqrt(-a^2 + b^2)*(a*cos(f*x + e) + b)*sin(f*x + e
) - a^2 + 2*b^2)/(b^2*cos(f*x + e)^2 + 2*a*b*cos(f*x + e) + a^2)))/((a^3 - a*b^2)*f), 1/2*((a^2 - b^2)*d*log(s
in(f*x + e) + 1) - (a^2 - b^2)*d*log(-sin(f*x + e) + 1) + 2*sqrt(a^2 - b^2)*(a*c - b*d)*arctan(-(a*cos(f*x + e
) + b)/(sqrt(a^2 - b^2)*sin(f*x + e))))/((a^3 - a*b^2)*f)]

________________________________________________________________________________________

Sympy [F]
time = 0.00, size = 0, normalized size = 0.00 \begin {gather*} \int \frac {c + d \sec {\left (e + f x \right )}}{a + b \cos {\left (e + f x \right )}}\, dx \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate((c+d*sec(f*x+e))/(a+b*cos(f*x+e)),x)

[Out]

Integral((c + d*sec(e + f*x))/(a + b*cos(e + f*x)), x)

________________________________________________________________________________________

Giac [A]
time = 0.50, size = 133, normalized size = 1.75 \begin {gather*} \frac {\frac {d \log \left ({\left | \tan \left (\frac {1}{2} \, f x + \frac {1}{2} \, e\right ) + 1 \right |}\right )}{a} - \frac {d \log \left ({\left | \tan \left (\frac {1}{2} \, f x + \frac {1}{2} \, e\right ) - 1 \right |}\right )}{a} - \frac {2 \, {\left (\pi \left \lfloor \frac {f x + e}{2 \, \pi } + \frac {1}{2} \right \rfloor \mathrm {sgn}\left (-2 \, a + 2 \, b\right ) + \arctan \left (-\frac {a \tan \left (\frac {1}{2} \, f x + \frac {1}{2} \, e\right ) - b \tan \left (\frac {1}{2} \, f x + \frac {1}{2} \, e\right )}{\sqrt {a^{2} - b^{2}}}\right )\right )} {\left (a c - b d\right )}}{\sqrt {a^{2} - b^{2}} a}}{f} \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate((c+d*sec(f*x+e))/(a+b*cos(f*x+e)),x, algorithm="giac")

[Out]

(d*log(abs(tan(1/2*f*x + 1/2*e) + 1))/a - d*log(abs(tan(1/2*f*x + 1/2*e) - 1))/a - 2*(pi*floor(1/2*(f*x + e)/p
i + 1/2)*sgn(-2*a + 2*b) + arctan(-(a*tan(1/2*f*x + 1/2*e) - b*tan(1/2*f*x + 1/2*e))/sqrt(a^2 - b^2)))*(a*c -
b*d)/(sqrt(a^2 - b^2)*a))/f

________________________________________________________________________________________

Mupad [B]
time = 3.55, size = 345, normalized size = 4.54 \begin {gather*} \frac {2\,d\,\mathrm {atanh}\left (\frac {\sin \left (\frac {e}{2}+\frac {f\,x}{2}\right )}{\cos \left (\frac {e}{2}+\frac {f\,x}{2}\right )}\right )}{a\,f}-\frac {b\,\left (d\,\ln \left (\frac {a\,\cos \left (\frac {e}{2}+\frac {f\,x}{2}\right )+b\,\cos \left (\frac {e}{2}+\frac {f\,x}{2}\right )-\sin \left (\frac {e}{2}+\frac {f\,x}{2}\right )\,\sqrt {b^2-a^2}}{\cos \left (\frac {e}{2}+\frac {f\,x}{2}\right )}\right )\,\sqrt {-\left (a+b\right )\,\left (a-b\right )}-d\,\ln \left (\frac {b\,\sin \left (\frac {e}{2}+\frac {f\,x}{2}\right )-a\,\sin \left (\frac {e}{2}+\frac {f\,x}{2}\right )+\cos \left (\frac {e}{2}+\frac {f\,x}{2}\right )\,\sqrt {b^2-a^2}}{\cos \left (\frac {e}{2}+\frac {f\,x}{2}\right )}\right )\,\sqrt {b^2-a^2}\right )+a\,c\,\ln \left (\frac {b\,\sin \left (\frac {e}{2}+\frac {f\,x}{2}\right )-a\,\sin \left (\frac {e}{2}+\frac {f\,x}{2}\right )+\cos \left (\frac {e}{2}+\frac {f\,x}{2}\right )\,\sqrt {b^2-a^2}}{\cos \left (\frac {e}{2}+\frac {f\,x}{2}\right )}\right )\,\sqrt {b^2-a^2}-a\,c\,\ln \left (\frac {a\,\cos \left (\frac {e}{2}+\frac {f\,x}{2}\right )+b\,\cos \left (\frac {e}{2}+\frac {f\,x}{2}\right )-\sin \left (\frac {e}{2}+\frac {f\,x}{2}\right )\,\sqrt {b^2-a^2}}{\cos \left (\frac {e}{2}+\frac {f\,x}{2}\right )}\right )\,\sqrt {-\left (a+b\right )\,\left (a-b\right )}}{a\,f\,\left (a^2-b^2\right )} \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

int((c + d/cos(e + f*x))/(a + b*cos(e + f*x)),x)

[Out]

(2*d*atanh(sin(e/2 + (f*x)/2)/cos(e/2 + (f*x)/2)))/(a*f) - (b*(d*log((a*cos(e/2 + (f*x)/2) + b*cos(e/2 + (f*x)
/2) - sin(e/2 + (f*x)/2)*(b^2 - a^2)^(1/2))/cos(e/2 + (f*x)/2))*(-(a + b)*(a - b))^(1/2) - d*log((b*sin(e/2 +
(f*x)/2) - a*sin(e/2 + (f*x)/2) + cos(e/2 + (f*x)/2)*(b^2 - a^2)^(1/2))/cos(e/2 + (f*x)/2))*(b^2 - a^2)^(1/2))
 + a*c*log((b*sin(e/2 + (f*x)/2) - a*sin(e/2 + (f*x)/2) + cos(e/2 + (f*x)/2)*(b^2 - a^2)^(1/2))/cos(e/2 + (f*x
)/2))*(b^2 - a^2)^(1/2) - a*c*log((a*cos(e/2 + (f*x)/2) + b*cos(e/2 + (f*x)/2) - sin(e/2 + (f*x)/2)*(b^2 - a^2
)^(1/2))/cos(e/2 + (f*x)/2))*(-(a + b)*(a - b))^(1/2))/(a*f*(a^2 - b^2))

________________________________________________________________________________________